/*
 * $Id: HelloWorld.java 471756 2006-11-06 15:01:43Z husted $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package example;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

import beans.Book;



/**
 * <code>Set welcome message.</code>
 */
public class HelloWorld extends BaseAction {

    public String execute() throws Exception {
    	System.out.println("function execute");
        return SUCCESS;
    }
    
    public String function1() throws Exception {
        System.out.println("function1");
        String test=this.getRequest().getParameter("test");
        PrintWriter pw = this.getResponse().getWriter();
        pw.println(test);
        pw.close();
        return null;
    }
    public String function2() throws Exception {
    	
        
		List<Book> books = new ArrayList<Book>();
		Book book1 = new Book();
		book1.setIsbn("bookOne");
		Book book2 = new Book();
		book2.setIsbn("bookTwo");
		Book book3 = new Book();
		book3.setIsbn("bookThree");
		books.add(book1);
		books.add(book2);
		books.add(book3);
		
		this.getRequest().setAttribute("books", books);
		System.out.println("function2");
		//return null;
        return "success";
    }

    
}
